﻿using System;

namespace DbFactory
{
    public static class SingletonFactory<T> where T : new()
    {
        private static T uniqueInstance;
        private static readonly object locker = new object();
        public static T GetInstance()
        {
            if (uniqueInstance == null)
            {
                lock (locker)
                {
                    if (uniqueInstance == null) uniqueInstance = new T();
                }
            }
            return uniqueInstance;
        }
    }
}
